package net.zf.web;

import cn.hutool.json.JSONUtil;
import io.micrometer.observation.ObservationRegistry;
import net.zf.base.ApplicationContextProvider;
import net.zf.base.ZFChatClient;
import net.zf.bean.MetaInfo;
import net.zf.bean.ModeInfo;
import net.zf.context.ModelContext;
import net.zf.context.ModelInfo;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.model.SimpleApiKey;
import org.springframework.ai.model.tool.DefaultToolCallingManager;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.ai.openai.OpenAiChatOptions;
import org.springframework.ai.openai.api.OpenAiApi;
import org.springframework.ai.tool.execution.DefaultToolExecutionExceptionProcessor;
import org.springframework.ai.tool.execution.ToolExecutionExceptionProcessor;
import org.springframework.ai.tool.resolution.SpringBeanToolCallbackResolver;
import org.springframework.ai.tool.resolution.ToolCallbackResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.support.RetryTemplate;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestClient;
import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.reactive.function.client.WebClient;

@RestController
@RequestMapping("/bean")
public class BeanController {

    @Autowired
    private ApplicationContextProvider applicationContextProvider;

    @Autowired
    private ModeInfo modeInfo;

    @GetMapping("/get")
    public String setDefaultModel(){
        return JSONUtil.toJsonStr(modeInfo);
    }

    @GetMapping("/update")
    public String update(){
        MetaInfo metaInfo = new MetaInfo();
        metaInfo.setScore("20");
        metaInfo.setName("KKKKKKK");
        modeInfo.setMetaInfo(metaInfo);

        return "success";
    }

}
